Skip to content

Conversation

mfulb
Copy link
Contributor

@mfulb mfulb commented Jul 1, 2025

With recent official PHP docker images the Zend OPCache extension is loaded by default. This is causing some test failures as PHP will output a warning message when the integration_runner attempts to load this extension. As a result any EXPECT statements in tests will fail due to this extra output.

The solution chosen was to use the “-m” option for the php and php-cgi binaries to probe if the Zend OPCache module is loaded by default in the PHP environment. Both binaries are used in testing so the defaults of both are considered. The value of the integration_runner command line option opcache_off is also noted. When a test is going to be run this information is used to determine if the zend_extension=opcache.so is needed as well as setting the values of opcache.enable and opcache.enable_cli. These INI values needed special handling because it is possible these are overwritten by values in the INI stanza of a given test case. Also consideration is needed to if the PHPMODULES stanza exists in the test case and specifies loading the opcache.so module.

mfulb added 2 commits June 30, 2025 16:59
Previously it was assumed that the Zend OPCache module was NOT loaded in the
environment which integration and mutliverse tests were run.  Now the PHP Docker
images have Zend OPCache loaded by default, causing errors when the
integration_runner also tried to load this module.  These changes identify if the module
is loaded by default and handles setting the opcache.enable and opcache.enable_cli
INI value based on the value of the "-opcache_off" command line option.
@newrelic-php-agent-bot
Copy link

newrelic-php-agent-bot commented Jul 1, 2025

Test Suite Status Result
Multiverse 8/8 passing
SOAK 85/85 passing

@codecov-commenter
Copy link

codecov-commenter commented Jul 1, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.20%. Comparing base (61d7343) to head (412fba7).

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #1097      +/-   ##
==========================================
- Coverage   77.27%   77.20%   -0.08%     
==========================================
  Files         199      199              
  Lines       28342    28343       +1     
==========================================
- Hits        21902    21882      -20     
- Misses       6440     6461      +21     
Flag Coverage Δ
agent-for-php-7.2 77.39% <ø> (-0.09%) ⬇️
agent-for-php-7.3 77.41% <ø> (-0.09%) ⬇️
agent-for-php-7.4 77.28% <ø> (-0.09%) ⬇️
agent-for-php-8.0 76.49% <ø> (-0.08%) ⬇️
agent-for-php-8.1 76.81% <ø> (-0.08%) ⬇️
agent-for-php-8.2 76.43% <ø> (-0.08%) ⬇️
agent-for-php-8.3 76.43% <ø> (-0.08%) ⬇️
agent-for-php-8.4 76.45% <ø> (-0.08%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mfulb mfulb marked this pull request as ready for review July 2, 2025 14:28
@mfulb mfulb requested review from ZNeumann and lavarou July 2, 2025 18:35
ZNeumann
ZNeumann previously approved these changes Jul 2, 2025
setOPCacheEnableCLI = false
}
}
if ctx.UseOPCache {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ctx.UseOPCache is actually the negation of the value of the --opcacheoff flag passed to integration_runner, which is false by default. This means that this branch is the default behavior. This also means that that --opcacheoff does not affect presence of opcache.so module.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems correct.

The MakeRun() function serves as a common starting point  for tests and it was brought
up that the manipulatiuon of the settings which occurrd in PhpTx() and CgiTx() could
be unified here to clean up the code.

This code also asserts if a C test case is run as that is not a supported configuration.
lavarou
lavarou previously approved these changes Jul 2, 2025
@lavarou lavarou changed the title Fix/integration runner loading opcache tests: fix integration_runner opcache module loading Jul 2, 2025
@mfulb mfulb merged commit 546c0e5 into dev Jul 8, 2025
65 checks passed
@mfulb mfulb deleted the fix/integration-runner-loading-opcache branch July 8, 2025 14:26
hahuja2 pushed a commit that referenced this pull request Jul 8, 2025
With recent official PHP docker images the Zend OPCache extension is
loaded by default. This is causing some test failures as PHP will output
a warning message when the `integration_runner` attempts to load this
extension. As a result any `EXPECT` statements in tests will fail due to
this extra output.

The solution chosen was to use the “-m” option for the `php` and
`php-cgi` binaries to probe if the Zend OPCache module is loaded by
default in the PHP environment. Both binaries are used in testing so the
defaults of both are considered. The value of the integration_runner
command line option `opcache_off` is also noted. When a test is going to
be run this information is used to determine if the
`zend_extension=opcache.so` is needed as well as setting the values of
`opcache.enable` and `opcache.enable_cli`. These INI values needed
special handling because it is possible these are overwritten by values
in the INI stanza of a given test case. Also consideration is needed to
if the `PHPMODULES` stanza exists in the test case and specifies loading
the `opcache.so` module.

---------

Co-authored-by: Michal Nowacki <[email protected]>
hahuja2 pushed a commit that referenced this pull request Jul 9, 2025
With recent official PHP docker images the Zend OPCache extension is
loaded by default. This is causing some test failures as PHP will output
a warning message when the `integration_runner` attempts to load this
extension. As a result any `EXPECT` statements in tests will fail due to
this extra output.

The solution chosen was to use the “-m” option for the `php` and
`php-cgi` binaries to probe if the Zend OPCache module is loaded by
default in the PHP environment. Both binaries are used in testing so the
defaults of both are considered. The value of the integration_runner
command line option `opcache_off` is also noted. When a test is going to
be run this information is used to determine if the
`zend_extension=opcache.so` is needed as well as setting the values of
`opcache.enable` and `opcache.enable_cli`. These INI values needed
special handling because it is possible these are overwritten by values
in the INI stanza of a given test case. Also consideration is needed to
if the `PHPMODULES` stanza exists in the test case and specifies loading
the `opcache.so` module.

---------

Co-authored-by: Michal Nowacki <[email protected]>
@zsistla zsistla added this to the next-release milestone Aug 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants